import rclpy
from rclpy.node import Node
class MyNode(Node):
    def __init__(self):
        super().__init__("helloworld_node_py") #调用父类的__init__方法，要用super()，调用普通父类方法用self
        self.get_logger().info("新方法创建节点")
def main():
    rclpy.init()
    node=MyNode()
    rclpy.shutdown()
if "__main__"==__name__:
    main()           